#include <iostream>
#include "manager_service.h"


bool ManagerService::addManager(int _id,char* _name,char* _password)
{
    Manager manager(_id,_name,_password);
    //cout << "添加成功！" << endl;
    vecManager.push_back(manager);
    return true;
}

bool ManagerService::deleteManager(int _id)
{
    vector<Manager>::iterator it;
    for(it = vecManager.begin();it != vecManager.end();it++)
    {
        if(_id == it->id)
        {
            vecManager.erase(it);
            return true;
        }
    }
    return false;
}

void ManagerService::listManager(void)
{
    cout << "ID" << "  "<< "name" << "   " "password"<<endl;
    for(unsigned int i = 0;i < vecManager.size();i++)
    {
         Manager manager = vecManager[i];
         cout << manager.id <<" " << manager.name << "   " << manager.password <<endl;  
    }
    get_char();
}
